﻿<div>
    <div class="mb-6">Active picker: <code> @_activePicker </code></div>
    <MMenu @bind-Value="_menu"
           CloseOnContentClick="false"
           Transition="scale-transition"
           OffsetY
           MinWidth="@("auto")">
        <ActivatorContent>
            <MTextField @bind-Value="_date"
                        Label="Birthday date"
                        PrependIcon="mdi-calendar"
                        Readonly
                        @attributes="context.Attrs"></MTextField>
        </ActivatorContent>
        <ChildContent>
            <MDatePicker @bind-Value="_date"
                         ActivePicker="_activePicker"
                         OnActivePickerUpdate="val=>_activePicker=val"
                         Max="DateOnly.FromDateTime(DateTime.Now)"
                         OnInput="()=>_menu=false"
                         Min="new DateOnly(1950,1,1)"></MDatePicker>
        </ChildContent>
    </MMenu>
</div>

  @code {
    private DatePickerType _activePicker = DatePickerType.Year;
    private DateOnly _date = DateOnly.FromDateTime(DateTime.Now);
    private bool _menu;
  }
